<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<div id="app"></div>

<template id="my-app">
  <div>
    <h2>{{message}}</h2>
    <h2>{{count*10}}</h2>
    <!-- <h2>{{message.split(' ').reverse().join(',')}}</h2> -->
    <h2>{{getReverseMessage()}}</h2>
    <h2>{{isShow?'你哈':''}}</h2>

    <!-- <h2>{{'var name='aaa'}}</h2>  上面是执行语句
       这个编译和执行语句不能写在里面，要编译 -->
    <!-- <h2>{{if(true) {return 'abc'}}}</h2>   依托数据源-->
  </div>
</template>

<body>
  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>


  <script>
    Vue.createApp({
      template: '#my-app',
      data: function () {
        return {
          message: 'Hello World',
          count: 1,
          isShow: true
        }
      },
      methods: {
        getReverseMessage() {
          return this.message.split(' ').reverse().join(',')
        }
      }
    }).mount('#app')
  </script>
</body>

</html>